import Request from "@/utils/request";
import {SEARCHOBJ,SEARCHKEYWORD,REAlTIMESEARCH} from '@/type/resType/searchResType'
import {xmlyResData} from "@/type/resType/resType";
class SearchRequest extends Request {

  // 获取搜索导航数据
  getSearchNav(){
    return this.get<SEARCHOBJ>({
      url:'/hotWordBillboardCategory'
    })
  }

  // 某个搜索分类下的关键字列表
  // hotWordBillboard/list/2.0?categoryId=-1&size=24
  getSearchKeyword(id:number){
    return this.get<SEARCHKEYWORD>({
      url:`/hotWordBillboard/list/2.0?categoryId=${id}&size=24`,
    })
  }
  
  // 实时搜索关键字列表
  // https://m.ximalaya.com/revision/suggest?kw=ab&paidFilter=false&scope=all
  getRealTimeSearch(value:string){
    return this.get<xmlyResData<REAlTIMESEARCH>>({
      url:`revision/suggest?kw=${value}&paidFilter=false&scope=all`
    })
  }
}

export default new SearchRequest()